<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>http::parser::parser (5 of 5 overloads)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Chapter&#160;1.&#160;Boost.Beast">
<link rel="up" href="../parser.html" title="http::parser::parser">
<link rel="prev" href="overload4.html" title="http::parser::parser (4 of 5 overloads)">
<link rel="next" href="../put.html" title="http::parser::put">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload4.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../parser.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../put.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h6 class="title">
<a name="beast.ref.boost__beast__http__parser.parser.overload5"></a><a class="link" href="overload5.html" title="http::parser::parser (5 of 5 overloads)">http::parser::parser
          (5 of 5 overloads)</a>
</h6></div></div></div>
<p>
            Construct a parser from another parser, changing the Body type.
          </p>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h0"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.synopsis"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.synopsis">Synopsis</a>
          </h7><pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
    <span class="keyword">class</span> <span class="identifier">OtherBody</span><span class="special">,</span>
    <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">&gt;</span>
<span class="identifier">parser</span><span class="special">(</span>
    <span class="identifier">parser</span><span class="special">&lt;</span> <span class="identifier">isRequest</span><span class="special">,</span> <span class="identifier">OtherBody</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="special">&gt;&amp;&amp;</span> <span class="identifier">parser</span><span class="special">,</span>
    <span class="identifier">Args</span><span class="special">&amp;&amp;...</span> <span class="identifier">args</span><span class="special">);</span>
</pre>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h1"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.description"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.description">Description</a>
          </h7><p>
            This constructs a new parser by move constructing the header from another
            parser with a different body type. The constructed-from parser must not
            have any parsed body octets or initialized <span class="bold"><strong>BodyReader</strong></span>,
            otherwise an exception is generated.
          </p>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h2"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.example"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.example">Example</a>
          </h7><pre class="programlisting"><span class="comment">// Deferred body type commitment</span>
<span class="identifier">request_parser</span><span class="special">&lt;</span><span class="identifier">empty_body</span><span class="special">&gt;</span> <span class="identifier">req0</span><span class="special">;</span>
<span class="special">...</span>
<span class="identifier">request_parser</span><span class="special">&lt;</span><span class="identifier">string_body</span><span class="special">&gt;</span> <span class="identifier">req</span><span class="special">{</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">req0</span><span class="special">)};</span>
</pre>
<p>
            If an exception is thrown, the state of the constructed-from parser is
            undefined.
          </p>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h3"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.parameters"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.parameters">Parameters</a>
          </h7><div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                    <p>
                      Name
                    </p>
                  </th>
<th>
                    <p>
                      Description
                    </p>
                  </th>
</tr></thead>
<tbody>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">parser</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      The other parser to construct from. After this call returns,
                      the constructed-from parser may only be destroyed.
                    </p>
                  </td>
</tr>
<tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">args</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      Optional arguments forwarded to the message constructor.
                    </p>
                  </td>
</tr>
</tbody>
</table></div>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h4"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.exceptions"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.exceptions">Exceptions</a>
          </h7><div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                    <p>
                      Type
                    </p>
                  </th>
<th>
                    <p>
                      Thrown On
                    </p>
                  </th>
</tr></thead>
<tbody><tr>
<td>
                    <p>
                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code>
                    </p>
                  </td>
<td>
                    <p>
                      Thrown when the constructed-from parser has already initialized
                      a body reader.
                    </p>
                  </td>
</tr></tbody>
</table></div>
<h7><a name="beast.ref.boost__beast__http__parser.parser.overload5.h5"></a>
            <span class="phrase"><a name="beast.ref.boost__beast__http__parser.parser.overload5.remarks"></a></span><a class="link" href="overload5.html#beast.ref.boost__beast__http__parser.parser.overload5.remarks">Remarks</a>
          </h7><p>
            This function participates in overload resolution only if the other parser
            uses a different body type.
          </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2016, 2017 Vinnie Falco<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overload4.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../parser.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../put.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
